import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

import org.junit.*;

import edu.gatech.oad.mule.Configuration;
import edu.gatech.oad.mule.MULE;
import edu.gatech.oad.mule.MULEStable;
import edu.gatech.oad.mule.Player;
import edu.gatech.oad.mule.Tile;
import edu.gatech.oad.mule.config.interfaces._ConfigurationPanel;
import edu.gatech.oad.mule.model.GameStateMachine.GameState;

/**
 * This class performs JUnit testing on the 
 * interact() method inside of the MULEStable class
 * 
 * @author Natasha Parekh
 * @version %I%, %G%\
 */

public class MuleStableInteractTest {
	private Player player;
	private MULE mule;
	private MULEStable stable;
	
	@Before
	public void setUp(){
		player = new Player();
		mule = new MULE();
		stable = new MULEStable(10, 20, 100, 100);
			//	interact(Player p, GameState phase, int round, int time){
	}
	/*
	 * player is starting off with no mules
	 */
	@Test
	public void testNoMules() {
		assertFalse(player.hasMule());
	}
	
	/*
	 * player can buy mule if money is enough 
	 * and if stable has mules and if doesn't
	 * already have one
	 */
	@Test
	public void testBuyMule() {
		assertFalse(player.hasMule());
		player.addMoney(5000);
		stable.interact(player, GameState.DEVELOPMENT, 1, 60);
		assertTrue(player.hasMule());
	}
	/*
	 * player does not acquire a mule if it
	 * does not have enough money to buy it
	 */
	@Test
	public void testInsufficientFunds(){
		player.addMoney(-5000);
		stable.interact(player, GameState.DEVELOPMENT, 1, 60);
		assertEquals(false, player.hasMule());
	}
	
	/*
	 * player does not acquire a mule if 
	 * there are none in stable
	 */
	@Test
	public void noMules(){
		stable.setMULECount(0);
		stable.interact(player, GameState.DEVELOPMENT, 1, 60);
		assertEquals(false, player.hasMule());
	}
	
	/*
	 * player's hasMule does not change if  
	 * it already had one 
	 */
	@Test
	public void alreadyHasMule(){
		stable.interact(player, GameState.DEVELOPMENT, 1, 60);
		stable.interact(player, GameState.DEVELOPMENT, 1, 60);
		assertTrue(player.hasMule());
	}
	

}
